<?php

// $Id$

require_once('tcms_vpage_dbc.class.php');
require_once('tcms_vpage_ci_dbc.class.php');
require_once('tcms_vpage_system_attribute_dbc.class.php');
require_once('tcms_vpage_category_dbc.class.php');



class TCMS_VPage_Deleter extends Tangra_Class {
	public static function delete(DB_Connection $dbc, $vpage_id, $hidden_inc_path) {
		TCMS_VPage_DBC::delete($dbc, $vpage_id);
		TCMS_VPage_System_Attribute_DBC::delete_for_vpage($dbc, $vpage_id);
		TCMS_VPage_Category_DBC::delete_for_vpage($dbc, $vpage_id);

//		$cis = TCMS_VPage_CI_DBC::load_cis_for_page($dbc, $vpage_id);
//
//		foreach($cis as $ci) {
//			$used_by_other_pages = TCMS_VPage_CI_DBC::is_used_by_other_vpages($dbc, $ci->get_ci_id(), $vpage_id);
//
//			if (!$used_by_other_pages) {
//				$item_class = $ci_type->get_class_name();
//				if (!class_exists($item_class)) {
//					require_once($hidden_inc_path.$ci_type->get_class_path());
//				}
//				$item = new $item_class;
//				call_user_func_array(array($item_class, 'delete_cascade'), array($dbc, $ci->get_ci_id()));
//			}
//
//			TCMS_VPage_CI_DBC::delete($dbc, $ci->get_id());
//		}
	}
}